/**
 * 
 */
package com.gr.staffpm.pages.behaviour;

import org.apache.wicket.Component;
import org.apache.wicket.ResourceReference;
import org.apache.wicket.behavior.AbstractBehavior;
import org.apache.wicket.markup.html.IHeaderResponse;

import com.gr.staffpm.js.StaffPMJSScope;


/**
 * To be added to any page that wishes to show a loading indicator on a link or submit click
 * @author Graham Rhodes 8 Jan 2011 20:01:51
 */
public class AppLoadingIndicatorBehaviour extends AbstractBehavior {

    private static final long serialVersionUID = 1L;

    @Override
    public void bind(Component component) {
        component.setOutputMarkupId(true);
    }

    @Override
    public void renderHead(IHeaderResponse iHeaderResponse) {
        super.renderHead(iHeaderResponse);
        iHeaderResponse.renderJavascriptReference(new ResourceReference(StaffPMJSScope.class, "loading.js"));
    }

    @Override
    public boolean isTemporary() {
        return false;
    }
}
